package com.touni.designpattern.interpreterpattern.expression;

/**
 * @ClassName : AndExpression
 * @Description :
 * @Author : lwq
 * @Date: 2020-11-21 10:25
 */
public class AndExpression implements Expression {
    private Expression expressionOne;
    private Expression expressionTwo;

    public AndExpression(Expression expressionOne,Expression expressionTwo){
        this.expressionOne = expressionOne;
        this.expressionTwo = expressionTwo;
    }

    @Override
    public boolean interpreter(String text) {
        if (expressionOne.interpreter(text) && expressionTwo.interpreter(text)){
            return true;
        }
        return false;
    }
}
